﻿using Shop.RemoteModel.PageTemplate;
using Shop.RemoteModel.PageTemplate.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class PageTemplateEvent : IRpcApiService
    {
        private readonly IPageTemplateService _Service;

        public PageTemplateEvent ( IPageTemplateService service )
        {
            this._Service = service;
        }

        public long AddPageTemplate ( AddPageTemplate add )
        {
            return this._Service.Add(add.Datum);
        }

        public void DeletePageTemplate ( DeletePageTemplate obj )
        {
            this._Service.Delete(obj.Id);
        }

        public bool EnablePageTemplate ( EnablePageTemplate obj )
        {
            return this._Service.Enable(obj.Id);
        }

        public PageTemplateDto GetPageTemplate ( GetPageTemplate obj )
        {
            return this._Service.Get(obj.Id);
        }

        public PagingResult<PageTemplateDto> QueryPageTemplate ( QueryPageTemplate param )
        {
            return this._Service.Query(param.Query, param.ToBasicPage());
        }

        public bool SetPageTemplate ( SetPageTemplate set )
        {
            return this._Service.Set(set.Id, set.Datum);
        }
    }
}
